package com.detection.tcp.utils;

import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.detection.common.config.DetectionConfig;
import com.detection.tcp.domain.TCPMessage;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class DockingUtils {

    public static void postForTCP(TCPMessage message){
        if (!Boolean.parseBoolean(DetectionConfig.getIsSendTCP())){
            return;
        }
        String json = JSON.toJSONString(message);
        String body = HttpRequest.post(DetectionConfig.getSendTCPIP() + "/receive/tcp")
                .body(json)
                .execute().body();
        log.debug(body);
    }

}
